{% extends "base.html" %}
{% block content %}
<h2>Staff Form</h2>
{% if error %}<p style="color:red">{{ error }}</p>{% endif %}
<form method="post">
  Name: <input name="name" value="{{ form.name if form else '' }}"><br>
  Gender:
  <select name="gender">
    <option {% if form and form.gender=='男' %}selected{% endif %}>Male</option>
    <option {% if form and form.gender=='女' %}selected{% endif %}>Female</option>
  </select><br>
  Age: <input name="age" value="{{ form.age if form else '' }}" type="number"><br>
  Role: <input name="role" value="{{ form.role if form else '' }}"><br>
  Specialty: <input name="specialty" value="{{ form.specialty if form else '' }}"><br>
  Phone: <input name="phone" value="{{ form.phone if form else '' }}"><br>
  Email: <input name="email" value="{{ form.email if form else '' }}"><br>
  Department:
  <select name="dept_id">
    <option value="">--None--</option>
    {% for d in depts %}
      <option value="{{ d.dept_id }}" {% if form and form.dept_id==d.dept_id %}selected{% endif %}>{{ d.name }}</option>
    {% endfor %}
  </select><br>
  <button type="submit">Save</button>
</form>
{% endblock %}
